﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using MS.Data.API.Read.Command.User;
using MS.Data.Domain;
using MS.Data.ErrorCode;

namespace MS.Data.API.Read.Controllers
{
    /// <summary>
    /// API控制器-读 用户
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MangUserController : ControllerBase
    {
        IMediator mediator;

        public MangUserController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 显示角色
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<List<Role>>> GetRoleInfo()
        {
            GetRoleCommand command = new GetRoleCommand();
            return mediator.Send(command);
        }
        /// <summary>
        /// 显示用户列表
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<APIPing<Domain.User>>> GetUserList([FromQuery] GetUserCommand command)
        {
            return mediator.Send(command);
        }
    }
}
